<?php

use swap\visitor;

class resume_filter extends \swap\before_filter {
    
    public static function run($context) {
        $id = $context['id'];
        $resume = resume_model::get_by_id($id);
        if ($resume === null) {
            self::forward_404('非法请求');
        }
        
        // 上下文中设置$resume以及$id
        visitor::set_value('resume', $resume);
        visitor::set_value('id', $id);
    }
    
}